if(typeof(Edushare) == "undefined") Edushare = {};
if(typeof(Edushare.ESPublic) == "undefined") Edushare.ESPublic = {};
Edushare.ESPublic.globalVar = {
									isPeopleOpen:false
								};


$(document).ready(function(){
	
	/** cleanup all empty left menu-item container */
	$('.es-univLMenu').each(function(){
		if($(this).children().size()<1){
			$(this).remove();
		}
	});
	
	
	/** If any of the item under People pull-down menu is selected.. pull down the menu */
	if($(".pplSubMenu").parent().find('.es-selected').size()>0){
		Edushare.ESPublic.globalVar.isPeopleOpen = true;
		$(".pplSubMenu").parent().children("ul").slideDown();		
	}
	
	/** Handle highlighting of pull down people menu and it'e item */
	$(".pplSubMenu").click(function(){
		if(Edushare.ESPublic.globalVar.isPeopleOpen){
			Edushare.ESPublic.globalVar.isPeopleOpen = false;
			$(this).find('#pplExpand').html('+');
			$(this).parent().children("ul").slideUp();
			if($(".pplSubMenu").parent().find('.es-selected').size()>0)
			{
				$(this).parent().addClass('es-selected');
			}
		}else{
			Edushare.ESPublic.globalVar.isPeopleOpen = true;
			$(this).find('#pplExpand').html('&mdash;');
			$(this).parent().children("ul").slideDown();
			if($(".pplSubMenu").parent().find('.es-selected').size()>0)
			{
				$(this).parent().removeClass('es-selected');
			}
		}
	});
});